import 'package:flutter_web_view/widget/f_webview/webview_controller.dart';

/// WebView 策略类，封装通用API接口
abstract class WebViewStrategy {
  /// 初始化Url
  final String initialUrl;

  /// Title改变回调
  final void Function(FWebViewController controller, String? url)?
      onTitleChanged;

  /// WebView创建时回调
  final void Function(FWebViewController controller)? onWebViewCreated;

  /// 进度改变回调
  /// [progress] 进度从0 ~ 100
  final void Function(FWebViewController controller, int progress)?
      onProgressChanged;

  /// 加载完毕
  final void Function(FWebViewController controller, String? url)? onLoadStop;

  WebViewStrategy(
    this.initialUrl, {
    this.onTitleChanged,
    this.onWebViewCreated,
    this.onProgressChanged,
    this.onLoadStop,
  });
}
